package com.content.view.Share.Progress
{
	import com.clerkq.ProgressBar.ProgressBar;
	import com.clerkq.ProgressBar.ProgressBarCircle;
	import com.content.model.LoadedAssets.FontProxy;
	import com.library.core.IDisposable;
	import com.library.core.UIObject;
	import com.library.utils.Geometry;
	
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.text.AntiAliasType;
	import flash.text.TextFormat;
	
	import gs.TweenLite;
	
	public class Progress extends UIObject implements IDisposable
	{
		public static const NAME:String							= 'ProgressView';
		
		public static const SHOW:String							= NAME + "-" + 'Show';
		public static const HIDE:String							= NAME + "-" + 'Hide';
		public static const UPDATE:String						= NAME + "-" + 'Update';
		
		//private var textField:TextField;
		private var _loadingBar:ProgressBar;
		
		public function Progress()
		{
			_loadingBar = new ProgressBarCircle();
			addChild(_loadingBar);
		}
		
		/* Public Method
		* ---------------------------------------------------- */
		public function SetLayout(sWidth:int, sHeight:int):void{
//			_loadingBar.x = int((sWidth - _loadingBar.width)/2);
//			_loadingBar.y = int((sHeight - _loadingBar.height)/2);
			
			// 如果是 ProgressBarCircle， 则其中点在几何中心，定位需要调整
			_loadingBar.x = int(sWidth/2);
			_loadingBar.y = int(sHeight/2);
		}
		
		public function Show():void	{ TweenLite.to( this, 0.5, { autoAlpha: 1 } ); }		
		public function Hide():void	{ TweenLite.to( this, 0.5, { autoAlpha: 0 } ); }
		
		public function update(percentage:Number):void
		{
			_loadingBar.SetPercentage(percentage);
		}
		
		public function Dispose():void
		{
			_loadingBar.Dispose();
		}
	}
}